package com.ruoyi.common.constant;

import com.google.common.collect.Lists;
import com.ruoyi.common.enums.DictCodeEnum;
import io.jsonwebtoken.Claims;

import java.util.Arrays;
import java.util.List;

/**
 * 通用常量信息
 *
 * @author ruoyi
 */
public class Constants
{
    /**
     * UTF-8 字符集
     */
    public static final String UTF8 = "UTF-8";

    /**
     * GBK 字符集
     */
    public static final String GBK = "GBK";

    /**
     * www主域
     */
    public static final String WWW = "www.";

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";

    /**
     * 通用成功标识
     */
    public static final String SUCCESS = "0";

    /**
     * 通用失败标识
     */
    public static final String FAIL = "1";

    /**
     * 登录成功
     */
    public static final String LOGIN_SUCCESS = "Success";

    /**
     * 注销
     */
    public static final String LOGOUT = "Logout";

    /**
     * 注册
     */
    public static final String REGISTER = "Register";

    /**
     * 登录失败
     */
    public static final String LOGIN_FAIL = "Error";

    /**
     * 验证码有效期（分钟）
     */
    public static final Integer CAPTCHA_EXPIRATION = 2;

    /**
     * 令牌
     */
    public static final String TOKEN = "token";

    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";

    /**
     * 令牌前缀
     */
    public static final String LOGIN_USER_KEY = "login_user_key";

    /**
     * 用户ID
     */
    public static final String JWT_USERID = "userid";

    /**
     * 用户名称
     */
    public static final String JWT_USERNAME = Claims.SUBJECT;

    /**
     * 用户头像
     */
    public static final String JWT_AVATAR = "avatar";

    /**
     * 创建时间
     */
    public static final String JWT_CREATED = "created";

    /**
     * 用户权限
     */
    public static final String JWT_AUTHORITIES = "authorities";

    /**
     * 资源映射路径 前缀
     */
    public static final String RESOURCE_PREFIX = "/profile";

    /**
     * RMI 远程方法调用
     */
    public static final String LOOKUP_RMI = "rmi:";

    /**
     * LDAP 远程方法调用
     */
    public static final String LOOKUP_LDAP = "ldap:";

    /** 倒序排序 */
    public static final String ORDER_DESC = "desc";

    /** 升序排序 */
    public static final String ORDER_ASC = "asc";

    /** 时间排序 */
    public static final String ORDER_COLUMN = "createTime";

    /**
     * 缓存前缀
     */
    public static final String CACHE_AREA_KEY_PREFIX = "dict:cache:";

    /**
     * 超级管理员
     */
    public static final String SUPER_ADMIN = "admin";

    /**
     * 核心线程数
     */
    public static final Integer CORE_SIZE = 20;

    /**
     * 最大线程数
     */
    public static final Integer MAX_SIZE = 50;

    /** 默认限制IP访问次数 */
    public static final Integer IP_ACCESS_LIMIT_COUNT = 10;

    /**
     * 中划线
     */
    public static final String STRIKE = "-";

    /**
     * 以上
     */
    public static final String BELOW = "以上";

    /**
     * 以下
     */
    public static final String MORE_THAN = "少于";

    /**
     * LDAPS 远程方法调用
     */
    public static final String LOOKUP_LDAPS = "ldaps:";

    /**
     * 定时任务白名单配置（仅允许访问的包名，如其他需要可以自行添加）
     */
    public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };

    /** 直辖市 */
    public static final List<String> DIRECTLY_CITY_LIST = Arrays.asList("北京市", "天津市", "上海市", "重庆市");

    /** 地区与课程类型code */
    public static final List<String> REGION_COURSE_CODE_LIST = Lists.newArrayList(DictCodeEnum.REGION.getCode(), DictCodeEnum.COURSE_TYPE.getCode());

    /** 资料类型 */
    public static final List<String> DOC_EXT_LIST = Lists.newArrayList("pdf", "doc", "docx", "ppt", "pptx", "txt");

    /** 图片类型 */
    public static final List<String> PIC_EXT_LIST = Lists.newArrayList("jpg", "jpeg", "png", "gif", "bmp", "svg", "webp");

    /** 竖线 */
    public static final String VERTICAL_LINE = "|";

    /** 时间显示文案 */
    public static final String DATE_NOT_SET = "时间待定";

    /** 顶层父级ID */
    public static final Long TOP_PARENT_ID = 0L;

    /** 用户端登录信息前缀 */
    public static final String CACHE_KEY_PREFIX = "customer:login";

    /** 微信扫码二维码状态缓存前缀 */
    public static final String WX_SCAN_KEY_PREFIX = "customer:wx:scan";

    /** 企业微信二维码缓存前缀 */
    public static final String QY_WX_QRCODE_URL_PREFIX = "wechat:company:qrcode";

    /** 2分钟过期时间 */
    public static final Integer TWO_MINUTES = 2;

    /** 不同渠道登录源 网站和微信 */
    public static final String PC_SOURCE_CODE = "pcSource";

    public static final String WX_SOURCE_CODE = "wxSource";

    /** 用户页面数字验证码code*/
    public static final String PAGE_NUMBER_VERIFY_CODE = "commonSource";

    /** 修改密码 source */
    public static final String UPDATE_PWD_SOURCE_CODE = "updatePwdSource";

    /** 默认省份 */
    public static final String DEFAULT_PROVINCE = "浙江省";

    /** 默认统计的视频类型 */
    public static final String DEFAULT_STAT_VIDEO_TYPE = "备考";

    /** 默认统计题库类型 */
    public static final String DEFAULT_STAT_BANK_TYPE = "备考";

    /** 默认真题类型的题库 */
    public static final String DEFAULT_TEST_BANK_TYPE = "真题";

    /** 模拟练习题库类型 */
    public static final String EXERCISE_TEST_BANK_TYPE = "练习";

    /** 默认课程类型 大类 */
    public static final String DEFAULT_COURSE_TYPE = "一级建造师";

    /** 默认商品skuCode */
    public static final String GOODS_SKU_CODE = "goodSkuCode";

    /** 视频资源直播类型 */
    public static final Long LIVE_VIDEO_TYPE = 452L;

    /** 视频看完标识 */
    public static final Integer VIDEO_END_FLAG = 2;

    /** 新增课程 */
    public static final Integer ADD_COURSE = 1;

    /** 减少课程 */
    public static final Integer DECR_COURSE = 2;

    /** 重置课程 */
    public static final Integer RESET_COURSE = 3;

    /** 重置回放*/
    public static final Integer RESET_LIVE_COURSE = 4;

    /** 默认生成用户的昵称前缀 */
    public static final String DEFAULT_USER_PREFIX = "zjwk";

    /**
     * 定时任务违规的字符
     */
    public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config" };
}
